<template>
    <v-details :detailData="detailData" :inputConfig="inputConfig" :rules="rules"></v-details>
</template>

<script>

    import details from 'commons/Detail'
    import baseMixin from "@/mixins/BaseMixin";

    export default {
        name: "UomDetail_detail",
        mixins: [baseMixin],
        props: {
            data: {
                type: Object
            }
        },
        data() {
            return {
                addflag: false,
                detailData: {},
                rules: {},
                routeData: {},
            }
        },
        computed: {
            inputConfig() {
                return [
                    [
                        {
                            type: "input",
                            label: "计量单位代码",
                            props: "uom_code",
                            disabled: this.addflag
                        },
                        {
                            type: "input",
                            label: this.$t('common.desc'),
                            props: "uom_desc",
                            disabled: true
                        },
                        {
                            type: "input",
                            label: this.$t('outbound.lottable01receiptconversion'),
                            props: "uom_conv",
                        },
                        {
                            type: "select",
                            label: "轮流",
                            props: "round_flag",
                            options: this.getOptions("codelkup/RNDMETH")
                        },
                        {
                            type: "select",
                            label: this.$t('security.tier'),
                            props: "uom_level",
                            options: this.getOptions("codelkup/UOMLEVEL")
                        },
                    ],
                    [
                        {
                            type: "input",
                            label: this.$t('config.height'),
                            props: "uom_height",
                        },
                        {
                            type: "input",
                            label: this.$t('config.width'),
                            props: "uom_width",
                        },
                        {
                            type: "input",
                            label: "深度",
                            props: "uom_depth",
                        },
                        {
                            type: "input",
                            label: this.$t('config.volume'),
                            props: "uom_cube",
                        },
                    ],
                    [
                        {
                            type: "input",
                            label: "平均毛重",
                            props: "avg_grs",
                        },
                        {
                            type: "input",
                            label: "平均净重",
                            props: "avg_net",
                        },
                        {
                            type: "input",
                            label: "平均皮重",
                            props: "avg_tare",
                        },
                        {
                            type: "select",
                            label: this.$t('config.weightUom'),
                            props: "wgt_uom",
                            options: this.getOptions("codelkup/WEIGHT")
                        },
                    ],
                    [
                        {
                            type: "input",
                            label: "计量单位成本",
                            props: "uom_cost",
                        },
                        {
                            type: "input",
                            label: "计量单位值",
                            props: "uom_value",
                        }
                    ]
                ]
            }
        },
        methods: {
            async getData() {
                try {
                    let res = await this.$api.get(`/queryItemGroupUomByCode/${this.routeData.uom_code}/${this.data.detailSelectData.cust_code}/${this.data.detailSelectData.item}`);
                    
                        this.detailData = res.bean;
                    
                } catch (e) {
                    this.$message.error(e);
                }
            },
        },
        mounted() {
            this.routeData = this.$store.state.temporary;
            this.getData();
        },
        watch: {},
        components: {
            'v-details': details
        }
    }
</script>

<style scoped>

</style>
